
import request from '@/utils/request'

// 获取电站天气
export const weatherInfoApi = (params) => {
  return request({
    url: '/bopeng-cms/station/weatherInfo',
    method: 'get',
    params
  })
}

// 获取电站概况
export const indexInfoApi = (params) => {
  return request({
    url: '/bopeng-cms/station/index/info',
    method: 'get',
    params
  })
}

// 获取电站实时功率
export const stationPowerApi = (params) => {
  return request({
    url: '/bopeng-cms/station/index/power',
    method: 'get',
    params
  })
}

// 获取电站累计电量
export const stationElectricApi = (params) => {
  return request({
    url: '/bopeng-cms/station/index/electricQuantities',
    method: 'get',
    params
  })
}

// 获取电站网关组件树形列表
export const deviceTreeListApi = (params) => {
  return request({
    url: '/bopeng-cms/device/treeList',
    method: 'get',
    params
  })
}

// 获取电站网关地图组件信息
export const deviceLocationApi = (params) => {
  return request({
    url: '/bopeng-cms/station/deviceLocationDetail',
    method: 'get',
    params
  })
}

// 获取电站网关组件详情实时数据
export const deviceDetailApi = (params) => {
  return request({
    url: '/bopeng-cms/device/realData',
    method: 'get',
    params
  })
}

// 电站网关组件 开启/关闭 type  开启:run 关闭:stop
export const deviceStatusHandApi = (type='run',data) => {
  return request({
    url: `/bopeng-cms/device/${type}`,
    method: 'post',
    data
  })
}

// 获取电站网关组件告警详情
export const deviceRuleDetailApi = (data) => {
  return request({
    url: '/bopeng-cms/device/ruleDetails',
    method: 'post',
    data
  })
}

// 获取电站发电量报表图表
export const stationElectricEchartsApi = (data) => {
  return request({
    url: '/bopeng-cms/station/quantity/report/table',
    method: 'post',
    data
  })
}

// 获取电站组件功率报表图表
export const stationPowerEchartsApi = (params) => {
  return request({
    url: '/bopeng-cms/station/device/report/power',
    method: 'get',
    params
  })
}

// 新增/编辑 电站用户 type 新增 add 编辑 edit
export const stationUserApi = (type='add',data) => {
  return request({
    url: `/bopeng-cms/station/user/${type}`,
    method: 'post',
    data
  })
}
// 获取电站用户详情
export const stationUserDetailApi = (params) => {
  return request({
    url: '/bopeng-cms/station/user/detail',
    method: 'get',
    params
  })
}
// 审核电站用户
export const stationUserAuditApi = (data) => {
  return request({
    url: '/bopeng-cms/station/user/audit',
    method: 'post',
    data
  })
}
// 电站用户启用/关闭
export const stationUserChangeStatusApi = (data) => {
  return request({
    url: '/bopeng-cms/station/user/changeStatus',
    method: 'post',
    data
  })
}

// 新增/编辑 预警规则 type 新增 add 编辑 edit
export const ruleConfigApi = (type='add',data) => {
  return request({
    url: `/bopeng-cms/ruleConfig/${type}`,
    method: 'post',
    data
  })
}
//删除预警规则
export const delRuleConfigApi = (data) => {
  return request({
    url: '/bopeng-cms/ruleConfig/delete',
    method: 'post',
    data
  })
}
